From e63c7db802e14bb5af3abf45539c0e6b2085cc23 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 11 Jun 2010 13:57:52 +0100 Subject: [PATCH] svm: use msr safe for erratum 383 Make erratum 383 use msr safe variants to work on top of KVM. Signed-off-by: Christoph Egger --- xen/arch/x86/hvm/svm/svm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 3e022e19d0..c29ff34ea5 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -849,10 +849,14 @@ static void svm_init_erratum_383(struct cpuinfo_x86 *c) if ( c->x86 != 0x10 ) return; - rdmsrl(MSR_AMD64_DC_CFG, msr_content); - wrmsrl(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)); - - amd_erratum383_found = 1; + /* use safe methods to be compatible with nested virtualization */ + if (rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 && + wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0) + { + amd_erratum383_found = 1; + } else { + printk("Failed to enable erratum 383\n"); + } } static int svm_cpu_up(void) -- 2.30.2